const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextWebpackPlugin = require('extract-text-webpack-plugin');
const miniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
  mode:'none',
  entry:'./src/index.js',
  output:{
    path: path.join(__dirname, './dist/'),
    filename: "index-[chunkhash:8].js",
    // publicPath:'/dist'
  },
  module:{
    rules:[
      {
        test:/\.css/,
        use:[miniCssExtractPlugin.loader, 'css-loader']
      }
    ]
    
  },
  plugins:[
    new HtmlWebpackPlugin({
      template: path.join(__dirname, "./src/index.html"),
      filename: "index.html",    
    }
    ),
    new miniCssExtractPlugin({ // 在plugins中配置属性
      filename: './[name]-[contenthash:8].min.css' // 配置提取出来的css名称
  })
  ]
}